<!DOCTYPE html>
<!--
  ~ Copyright (C) 2018 guomw.Inc. All rights reserved.
  ~ 项目名称： mysite
  ~ 文件名称： list.html
  ~ Date：18-10-15 下午3:33
  ~ Author: guomw
  -->

<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="/common/head::head('目标物配置')">
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <!--search-->
    <form role="form" class="search-panel" th:object="${detection}">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content p-m no-borders">
                        <!--<div class="form-inline font-bold">-->
                        <!--报告数据-->
                        <!--</div>-->


                        <p style="height: 8px;"></p>
                        <div class="form-inline">
                            <label class="control-label">编&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：</label>
                            <input type="text" class="form-control input-sm mb10" id="code" name="code"
                                   th:value="${detection.code}" th:if="${detection.code!=null}" disabled/>

                            <input type="text" class="form-control input-sm mb10" id="code" name="code"
                                   th:value="${detection.code}" th:if="${detection.code==null}"/>
                        </div>
                        <p style="height: 8px;"></p>
                        <div class="form-inline">
                            <label class="control-label">正常解读：</label>
                            <input type="text" class="form-control input-sm mb10 fa-mobile" id="normalExplain"
                                   name="normalExplain"
                                   th:value="${detection.normalExplain}" style="width: 800px;"/>
                        </div>
                        <p style="height: 8px;"></p>
                        <div class="form-inline">
                            <label class="control-label">非正常解读：</label>
                            <input type="text" class="form-control input-sm mb10 fa-mobile" id="abNormalExplain"
                                   name="abNormalExplain"
                                   th:value="${detection.abNormalExplain}" style="width: 800px;">
                        </div>

                        <p style="height: 8px;"></p>
                        <div class="form-inline">
                            <label class="control-label">排&nbsp;&nbsp;序&nbsp;&nbsp;号：</label>
                            <input type="text" class="form-control input-sm mb10 fa-mobile" id="sort"
                                   name="sort" value="template1" th:value="${detection.sort}"/>
                        </div>


                        <p style="height: 8px;"></p>
                        <div class="form-inline">
                            <button type="button" class="btn btn-success" onclick="uploadReport()">保存</button>
                            <input type="hidden" id="reportId" th:value="${detection.reportId}"/>
                            <input type="hidden" id="id" th:value="${detection.id}"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--search-->

</div>

<footer th:include="/common/footer::js"/>

<script>
    function uploadReport() {

        var params = {
            id: $("#id").val(),
            code: $("#code").val(),
            normalExplain: $("#normalExplain").val(),
            abNormalExplain: $("#abNormalExplain").val(),
            sort: $("#sort").val(),
            reportId: $("#reportId").val()

        };

        hotUtil.loading.show();
        hotUtil.ajaxCall("/detection/save", params, function (ret) {
            hotUtil.loading.close();
            if (ret.resultCode == 1) {
                swal("保存目标物成功", "", "success");
                window.location.href = "/detection/list/" + $("#reportId").val();
            } else {
                swal(ret.resultMsg, "", "warning")
            }
        });
    }


</script>
</body>
</html>
